<?php
$id = $_GET['id'];
$shopcode = 'shop' . $id;
if (isset(Yii::app()->request->cookies[$shopcode]->value)) {
    $shoparry = Yii::app()->request->cookies[$shopcode]->value;
    $savedCardArray = json_decode($shoparry, true);
}

$navbar = ShopNavbar::model()->findAll('flag=1 and parent=0 and shopid=' . $savedCardArray[0] . ' order by position ASC');
if (!empty($navbar)) {
    
    ?>

    <ul id="menuV2">
        <?php
        $lan=0;
        foreach ($navbar as $n) {
            $lan+=1;
            $style='';
            if($lan<2){
               $style='border: none'; 
            }
            ?>
            <li><a style='<?php echo $style; ?>' href="<?php echo Yii::app()->request->baseUrl . '/shop/' . $savedCardArray[2] . '/danh-muc/' . $n->url ; ?>"><img src="<?php echo Yii::app()->request->baseUrl . '/uploadshop/icon/' . $n->image; ?>"/><?php echo $n->title; ?></a>
                <?php
                $navbar1 = ShopNavbar::model()->findAll('flag=1 and shopid=' . $savedCardArray[0] . ' and parent=' . $n->id . ' order by position ASC');
                if (!empty($navbar1)) {
                    ?>
                    <ul class="sub">
                        <?php
                        foreach ($navbar1 as $n1) {
                            ?>
                            <li><a href="<?php echo Yii::app()->request->baseUrl . '/shop/' . $savedCardArray[2] . '/danh-muc/' . $n1->url ; ?>"><?php echo $n1->title; ?></a></li>
                        <?php } ?>
                    </ul>
                <?php } ?>
            </li>
        <?php } ?>
    </ul>

    <?php
}
?>